package com.neutech.neureg.controller;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.neutech.neureg.service.UserService;
import com.neutech.po.RegistLevelUser;
import com.neutech.vo.RegistLevelVo;

@RestController
@CrossOrigin("http://localhost:8081")
@RequestMapping("/neureg/user")
public class UserController {
	@Autowired
	private UserService userService;
	/*
	 * 添加用户
	 * @param:user 用户信息
	 * @return:添加成功还是失败，成功“success”,失败“error”
	 */
	@RequestMapping(value="/add",method=RequestMethod.POST)
	public String addNewUser(@RequestParam Map<String,List> reguser) {//@RequestParam 
		int result = userService.addUser(reguser);
		if(result ==1) {
			return "success";
		}else {
			return "error";
		}
	}
	/*
	 * 查询挂号级别
	 */
//	@RequestMapping(value="/toadd",method=RequestMethod.POST)
//	public RegistLevelVo selectRL() {
//		return userService.selectRegistLevel();
//	}
	
	@RequestMapping(value="/sel")
	public Map<String,List> selectRL(){
		return userService.selectRegistLevel();
	}
	
	
	/*
	 * 得到用户ID
	 */
//	@RequestMapping(value="/update",method=RequestMethod.POST)
//	public String updateUserById(In id) {//@RequestParam 
//		
//	}
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	/*
	 * 添加用户界面出现前，查询信息，填充下拉菜单
	 * @param:user 用户信息
	 * @retuen:
	 */
//	@RequestMapping(value="/toadd",method=RequestMethod.POST)
//	public String toNewUser() { 
//		int result = userService.toAddUser();
//		if(result ==1) {
//			return "success";
//		}else {
//			return "error";
//		}
//	}
}
